'''
for
    for 变量 in 序列:
        循环代码
while
'''
nums = (2,3,5,6,8,9)
for a in nums: # a代表nums的单个元素
    print(a+2)
names= ["tom","lily","二蛋"]

count = 1
for name in names:
    print(f"第{count}名字：{name}")
    count += 1

# range() 生成一个整数序列  0 1,2 ...10   2,5,8,11
"""
range(start,stop,step)
start:开始值 默认值0
stop:结束值  
范围：[start,stop)
step:跨步 默认值1
"""
# 2,5,8,11
a= range(2,12,3)
print(type(a))  #range
print(tuple(a))
print(list(a))

print(list(range(1,10,2))) #[1, 3, 5, 7, 9]
print(list(range(2,7)))  # 默认跨步是1 [2, 3, 4, 5, 6]
print(list(range(10)))  # 默认开始是0，跨步是1

print(list(range(20,2,-1)))
print(list(range(20,2,-2)))
print(list(range(20,29,-2)))

# 循环打印1-10
for i in range(1,11):
    print(i)

# 计算 1+2+3+……+100



